<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form th:action="@{/emp}" method="post">
    <input type="hidden" name="_method" value="put" th:if="${user}!=null">
    I D:<input type="number" name="id" th:value="${user!=null}?${user.id}"><br/>
    名 字:<input type="text" name="name" th:value="${user!=null}?${user.name}"><br/>
    性 别:<input type="radio"  name="gender" value="1" th:checked="${user!=null}?${user.gender == 1}"> 男 <input type="radio" name="gender" value="0" th:checked="${user!=null}?${user.gender == 0}"> 女 <br/>
    <button type="submit" th:text="${user!=null}?'修改':'添加'"></button>
</form>
</body>
</html>